<template>
  <t-dialog
    :header="`${header}-大纲详情`"
    :visible.sync="visible"
    :onClose="closeDialog"
    :closeOnOverlayClick="false"
    :confirmBtn="null"
    width="80%"
    top="5%"
    v-if="isDialog"
  >
    <div :style="{height:(reviewOpen)?'80vh':'65vh'}">

      <t-tabs  size="medium" v-model="tabValue">
        <t-tab-panel :class="[reviewOpen?'tab-full-panel':'tab-panel']" value="1" label="基本信息" :destroyOnHide="true">
              <t-sticky-tool
                :style="{ position: 'absolute', overflow: 'hidden',zIndex: 1000 }"
                :offset="[-40, -20]"
                @click="createPDF()"
              >
                <t-sticky-item  style="width: 80px" label="导出大纲PDF" >
                  <template #icon>
                    <t-icon name="file-pdf"></t-icon>
                  </template>
                </t-sticky-item>
              </t-sticky-tool>
          <t-form labelWidth="160px">
            <t-row style="align-items: stretch" :gutter="14">
              <t-col :span="6">
                <t-card class="step-card" size="small" title="基本信息">
                  <t-form-item label="项目编号：" name="projectNum">
                    {{projectData.projectNum || '暂未分配'}}
                  </t-form-item>
                  <t-form-item label="项目名称：" name="projectName">
                    {{data.projectName?data.projectName:projectData.projectName}}
                  </t-form-item>
                  <t-form-item label="承担单位：" >
                    {{projectData.declareDeptName}}
                  </t-form-item>
                  <t-form-item label="计划类别：" name="projectCategory">
                    {{ projectData.projectCategory | filterByTree(projectCategoryOptions) }}

                  </t-form-item>
                  <t-form-item label="学科分类：" name="subjectClassification">
                    {{projectData.subjectClassification | filterByDict(dict.type.subject_classification)}}
                  </t-form-item>

                  <t-form-item label="项目类型：" name="projectType">
                    {{projectData.projectType | filterByDict(dict.type.project_type)}}
                  </t-form-item>
                  <t-form-item label="申报日期：" name="declareDate">
                    {{projectData.declareDate}}
                  </t-form-item>
                  <t-form-item label="编制日期：" >
                    {{data.compileDate}}
                  </t-form-item>
                  <t-form-item label="项目开始时间：" name="startDate">
                    {{data.startDate?data.startDate:projectData.startDate}}
                  </t-form-item>
                  <t-form-item label="项目结束时间：" name="endDate">
                    {{data.endDate?data.endDate:projectData.endDate}}
                  </t-form-item>
                  <t-form-item label="关键词：" name="keyWord">
                    {{projectData.keyWord}}
                  </t-form-item>
                  <t-form-item label="建议经费总概算：" name="adviceFunding">
                    {{data.adviceFunding!== null?data.adviceFunding:projectData.adviceFunding}}万元
                  </t-form-item>
                  <t-form-item :label="site_tag==='jtt'?'申请厅补助经费：':'申请集团补助经费'" name="subsidyFunding">
                    {{data.subsidyFunding!== null?data.subsidyFunding:projectData.subsidyFunding}}万元
                  </t-form-item>
                  <t-form-item label="自筹经费：" name="zcFunding">
                    <div v-if="data.adviceFunding!==null">
                      {{ (data.adviceFunding*100 - data.subsidyFunding*100)/100}}万元
                    </div>
                    <div v-else>
                      {{ (projectData.adviceFunding*100 - projectData.subsidyFunding*100)/100}}万元
                    </div>
                  </t-form-item>
                </t-card>
              </t-col>
              <t-col  :span="6" >
                <t-card class="step-card" size="small" title="项目组情况">
                  <t-form-item label="总人数：" name="projectTeam.totalCount">
                   {{data.projectTeam.totalCount}}
                  </t-form-item>
                  <t-form-item label="高级职称人数：" name="projectTeam.highCount">
                    {{data.projectTeam.highCount}}
                  </t-form-item>
                  <t-form-item label="中级职称人数：" name="projectTeam.middleCount">
                    {{data.projectTeam.middleCount}}
                  </t-form-item>
                  <t-form-item label="初级职称人数：" name="projectTeam.primaryCount">
                    {{data.projectTeam.primaryCount}}
                  </t-form-item>
                  <t-form-item label="研究生人数：" name="projectTeam.postgraduate">
                    {{data.projectTeam.postgraduate}}
                  </t-form-item>
                  <t-form-item label="辅助人员人数：" name="projectTeam.auxilian">
                    {{data.projectTeam.auxilian}}
                  </t-form-item>
<!--                  <t-form-item label="项目概要：" >-->
<!--                    <div v-html="data.profile">-->
<!--                    </div>-->
<!--                  </t-form-item>-->
                </t-card>
              </t-col>
            </t-row>
            <t-row style="align-items: stretch" :gutter="14" v-if="!hideInfo">
              <t-col :span="6" >
                <t-card class="step-card" size="small" title="项目负责人">
                  <t-form-item label="姓名：" name="projectLeader.name">
                    {{projectData.projectLeader.name}}
                  </t-form-item>
                  <t-form-item label="性别：" name="projectLeader.sex">
                    {{projectData.projectLeader.sex  | filterByDict(dict.type.sys_user_sex)}}
                  </t-form-item>
                  <t-form-item label="出生年月：" name="projectLeader.birthDate">
                    {{projectData.projectLeader.birthDate}}
                  </t-form-item>
                  <t-form-item label="身份证号：" name="projectLeader.idCard">
                    {{projectData.projectLeader.idCard}}
                  </t-form-item>
                  <t-form-item label="工作单位：" name="projectLeader.companyId">
                    {{projectData.projectLeader.company}}
                  </t-form-item>
<!--                  <t-form-item label="归口单位：" name="projectLeader.companyId">-->
<!--                    {{projectData.attributeDeptName}}-->
<!--                  </t-form-item>-->
                  <t-form-item label="联系电话：" name="projectLeader.phone">
                    {{projectData.projectLeader.phone}}
                  </t-form-item>
                  <t-form-item label="通讯地址：" name="projectLeader.address">
                    {{projectData.projectLeader.address}}
                  </t-form-item>
                  <t-form-item label="电子信箱：" name="projectLeader.email">
                    {{projectData.projectLeader.email}}
                  </t-form-item>
                  <t-form-item label="邮编：" name="projectLeader.postCode">
                    {{projectData.projectLeader.postCode}}
                  </t-form-item>
                  <t-form-item label="毕业院校：" name="projectLeader.school">
                    {{projectData.projectLeader.school}}
                  </t-form-item>
                  <t-form-item label="学历：" name="projectLeader.education">
                    {{projectData.projectLeader.education | filterByDict(dict.type.education)}}
                  </t-form-item>
                  <t-form-item label="学位：" name="projectLeader.degree">
                    {{projectData.projectLeader.degree   | filterByDict(dict.type.degree)}}
                  </t-form-item>
                  <t-form-item label="所学专业：" name="projectLeader.majorName">
                    {{ projectData.projectLeader.majorName }}
                  </t-form-item>
                  <t-form-item label="现从事专业：" name="projectLeader.majorNowName">
                    {{ projectData.projectLeader.majorNowName }}
                  </t-form-item>
                  <t-form-item label="职务：" name="projectLeader.duty">
                    {{projectData.projectLeader.duty }}
                  </t-form-item>
                  <t-form-item label="技术职称：" name="projectLeader.profTitId">
                    {{ projectData.projectLeader.profTitId | filterByTree(profTitOptions) }}
                  </t-form-item>
                  <t-form-item label="职称：" name="projectLeader.profTit">
                    {{projectData.projectLeader.profTit    | filterByDict(dict.type.prof_tit) }}
                  </t-form-item>
                  <t-form-item label="在本项目中承担的任务：" name="projectLeader.task">
                    {{projectData.projectLeader.task}}
                  </t-form-item>
                </t-card>
              </t-col>
              <t-col :span="6" >
                <t-card class="step-card" size="small" title="项目联系人">
                  <t-form-item label="姓名：" name="projectLinker.name">
                    {{projectData.projectLinker.name}}
                  </t-form-item>
                  <t-form-item label="联系电话：" name="projectLinker.phone">
                    {{projectData.projectLinker.phone}}
                  </t-form-item>
                  <t-form-item label="通信地址：" name="projectLinker.address">
                    {{projectData.projectLinker.address}}
                  </t-form-item>
                  <t-form-item label="电子信箱：" name="projectLinker.email">
                    {{projectData.projectLinker.email}}
                  </t-form-item>
                  <t-form-item label="邮编：" name="projectLinker.postCode">
                    {{projectData.projectLinker.postCode}}
                  </t-form-item>
                </t-card>
              </t-col>
            </t-row>
          </t-form>
        </t-tab-panel>
        <t-tab-panel :class="[reviewOpen?'tab-full-panel':'tab-panel']" value="2" label="项目概要" :destroyOnHide="true">
          <t-card class="step-card" size="small" title="项目概要">
<!--          <div v-html="data.profile"></div>-->
            <inner-html :content="data.profile"></inner-html>

          </t-card>
        </t-tab-panel>
        <t-tab-panel :class="[reviewOpen?'tab-full-panel':'tab-panel']" value="3" label="前期研究及工作基础" :destroyOnHide="true">
          <t-row style="align-items: stretch" :gutter="14">
            <t-col :span="12">
              <t-card class="step-card" size="small" title="项目前期研究及工作基础（包括国内外同类技术研究现状分析及评价，应附主要参考文献及出处）">
<!--                <div v-html="data.projectOutlinePreWork.preliminaryWork"></div>-->
                <inner-html :content="data.projectOutlinePreWork.preliminaryWork"></inner-html>

              </t-card>
            </t-col>
          </t-row>
          <t-row style="align-items: stretch" :gutter="14">
            <t-col :span="12">
              <t-card class="step-card" size="small" title="参考文献">
                <project-background-literature ref="project-background-literature" phaseType="2" :projectId="objId" v-model="data.projectOutlinePreWork.literatures" :editOpen="false"></project-background-literature>
              </t-card>
            </t-col>
          </t-row>
        </t-tab-panel>
        <t-tab-panel :class="[reviewOpen?'tab-full-panel':'tab-panel']" value="4" label="研究、开发的背景、必要性" :destroyOnHide="true">
          <t-row style="align-items: stretch" :gutter="14">
            <t-col :span="12">
              <t-card class="step-card" size="small" title="项目研究、开发的背景、必要性（包括项目研究目的，市场需求前景或推广应用领域，达到的技术水平及在国民经济发展中的作用等）">
<!--                <div v-html="data.projectOutlineNecessity.necessity"></div>-->
                <inner-html :content="data.projectOutlineNecessity.necessity"></inner-html>

              </t-card>
            </t-col>
          </t-row>
        </t-tab-panel>
        <t-tab-panel :class="[reviewOpen?'tab-full-panel':'tab-panel']" value="5" label="研究、开发实施方案" :destroyOnHide="true">
          <t-row style="align-items: stretch" :gutter="14">
            <t-col :span="12">
              <t-card class="step-card" size="small" title="项目研究、开发实施方案（包括拟解决的关键问题，实施的具体内容及实施方案，拟采取的技术路线等）：">
<!--                <div class="content_style" v-html="data.projectOutlineImplPlan.implementationPlan"></div>-->
                <inner-html :content="data.projectOutlineImplPlan.implementationPlan"></inner-html>

              </t-card>
            </t-col>
          </t-row>
          <t-row style="align-items: stretch" :gutter="14">
            <t-col :span="12">
              <t-card class="step-card" size="small" title="项目研究开发进度（包括年度工作计划安排，项目完成期限）:">
                <project-research-plan v-model="data.projectOutlineImplPlan.researchPlans" :disableDate="disableDate" :projectId="objId" :editOpen="false" phaseType="2"></project-research-plan>
              </t-card>
            </t-col>
          </t-row>
        </t-tab-panel>
        <t-tab-panel :class="[reviewOpen?'tab-full-panel':'tab-panel']" value="6" label="考核目标和技术经济指标" :destroyOnHide="true">
            <t-row style="align-items: stretch" :gutter="14">
              <t-col :span="12">
                <t-card class="step-card" size="small" title="考核目标">
                  <project-approach-expect-results phaseType="2" :projectId="objId" ref="project-approach-expect-results" v-model="data.projectOutlineGoal.projectExpectResults" :editOpen="false"></project-approach-expect-results>
                </t-card>
              </t-col>
            </t-row>
          <t-row style="align-items: stretch" :gutter="14">
            <t-col :span="12">
              <t-card class="step-card" size="small" title="技术经济指标">
<!--                <div v-html="data.projectOutlineGoal.goal"></div>-->
                <inner-html :content="data.projectOutlineGoal.goal"></inner-html>

              </t-card>
            </t-col>
          </t-row>
        </t-tab-panel>
        <t-tab-panel :class="[reviewOpen?'tab-full-panel':'tab-panel']" value="7" label="单位信息" :destroyOnHide="true">
          <t-row style="align-items: stretch" :gutter="14">
            <t-col :span="12">
              <project-unit v-model="data.projectCompanyList" :projectId="objId" :adviceFunding="data.adviceFunding" :editOpen="false" phaseType="2"></project-unit>
            </t-col>
          </t-row>
        </t-tab-panel>
        <t-tab-panel :class="[reviewOpen?'tab-full-panel':'tab-panel']" value="8" label="研究人员"  v-if="!(hideByProjectType && projectData.projectType==='08')" :destroyOnHide="true">
          <t-row style="align-items: stretch" :gutter="14">
            <t-col :span="12">
              <project-member v-model="data.projectMembers" :projectId="objId" :editOpen="false" phaseType="2"></project-member>
            </t-col>
          </t-row>
        </t-tab-panel>
        <t-tab-panel :class="[reviewOpen?'tab-full-panel':'tab-panel']" value="9" label="经费预算" :destroyOnHide="true">
          <project-budget :contrastOpen="contrastOpen" v-model="data.projectBudget" :projectId="objId" :fundingObj="fundingObj" :editOpen="false" phaseType="2"></project-budget>
        </t-tab-panel>
        <t-tab-panel :class="[reviewOpen?'tab-full-panel':'tab-panel']" value="10" label="经济效益和社会效益评估" :destroyOnHide="true">
          <t-row style="align-items: stretch" :gutter="14">
            <t-col :span="12">
          <t-card class="step-card" size="small" title="经济效益和社会效益评估">
<!--            <div v-html="data.projectOutlineBenefits?.economicBenefits"></div>-->
            <inner-html :content="data.projectOutlineBenefits?.economicBenefits"></inner-html>

          </t-card>
            </t-col>
          </t-row>
        </t-tab-panel>
        <t-tab-panel :class="[reviewOpen?'tab-full-panel':'tab-panel']" value="11" label="其他问题" :destroyOnHide="true">
          <t-row style="align-items: stretch" :gutter="14">
            <t-col :span="12">
              <t-card class="step-card" size="small" title="其它需要说明的问题（软科学类研究项目要列明预期成果报告的章节）：">
<!--                <div class="content_style" v-html="data.projectOutlineOther?.otherProblems"></div>-->
                <inner-html :content="data.projectOutlineOther?.otherProblems"></inner-html>

              </t-card>
            </t-col>
          </t-row>
        </t-tab-panel>
        <t-tab-panel :class="[reviewOpen?'tab-full-panel':'tab-panel']" value="12" label="按专家评审意见修改说明" :destroyOnHide="true">
          <t-row v-if="projectData.isOldProject === '0'" style="align-items: stretch" :gutter="14">
            <t-col :span="12">
              <t-card class="step-card" size="small" title="专家评审意见">
                <approve-list-by-review-type review-type="1" :obj-id="objId"></approve-list-by-review-type>
              </t-card>
            </t-col>
          </t-row>
          <t-row style="align-items: stretch" :gutter="14">
            <t-col :span="12">
              <t-card class="step-card" size="small" title="按专家评审意见修改说明">
<!--                <div class="content_style" v-html="data.projectOutlineExplain?.content"></div>-->
                <inner-html :content="data.projectOutlineExplain?.content"></inner-html>

              </t-card>
            </t-col>
          </t-row>
        </t-tab-panel>
        <t-tab-panel :class="[reviewOpen?'tab-full-panel':'tab-panel']" value="13" label="附件信息" :destroyOnHide="true"  >
          <t-row style="align-items: stretch" :gutter="14">
            <t-col :span="12">
              <t-table v-if="isMyProject" row-key="id" :columns="fileColumns" :data="fileData">
                <template #op="{row}">
                  <file-upload @success="uploadSuccess"  tips="限制pdf、图片" accept="application/pdf,image/*" v-model="row.fileIds" :moduleKey="row.moduleKey"
                               :fileList="row.fileLists"
                               :multiple="true">
                    <t-button variant="outline">
                      <t-icon name="cloud-upload" slot="icon"/>
                      点击上传
                    </t-button>
                  </file-upload>
                </template>
                <template #c1="{row}">
                  <a v-if="row.c3" class="t-button-link" :href="`${file_domain}/${row.c3}`" target="_blank">{{ row.c1 }}</a>
                  <div v-else>{{ row.c1 }}</div>
                </template>
              </t-table>
              <t-table v-else row-key="id" :columns="fileColumns" :data="fileData">
                <template #c1="{row}">
                  <a v-if="row.c3" class="t-button-link" :href="`${file_domain}/${row.c3}`" target="_blank">{{ row.c1 }}</a>
                  <div v-else>{{ row.c1 }}</div>
                </template>
                <template  #op="{row}">
                  <div v-for="(item,index) in row.fileLists" :key="index">
                    <a class="t-button-link" target="_blank" :href="item.url" >
                      {{item.name}}
                    </a>
                  </div>
                </template>
              </t-table>
            </t-col>
          </t-row>
        </t-tab-panel>
      </t-tabs>

    </div>

  </t-dialog>
  <div v-else>
    <t-tabs  :size="size" v-model="tabValue">
      <t-tab-panel :class="[reviewOpen?'tab-full-panel':'tab-panel']" value="1" label="基本信息" :destroyOnHide="true">
        <t-form labelWidth="160px">
          <t-row   style="align-items: stretch;row-gap: 12px" :gutter="14">
            <t-col :span="6">
              <t-card class="step-card" size="small" title="基本信息">
                <t-form-item label="项目编号：" name="projectNum">
                  {{projectData.projectNum || '暂未分配'}}
                </t-form-item>
                <t-form-item label="项目名称：" :style="{color:data.projectName!==projectData.projectName && reviewOpen && contrastOpen?'red':''}" name="projectName">
                  {{data.projectName?data.projectName:projectData.projectName}}
                </t-form-item>
                <t-form-item label="承担单位：" >
                  {{projectData.declareDeptName}}
                </t-form-item>
                <t-form-item label="计划类别：" name="projectCategory">
                  {{ projectData.projectCategory | filterByTree(projectCategoryOptions) }}

                </t-form-item>
                <t-form-item label="学科分类：" name="subjectClassification">
                  {{projectData.subjectClassification | filterByDict(dict.type.subject_classification)}}
                </t-form-item>

                <t-form-item label="项目类型：" name="projectType">
                  {{projectData.projectType | filterByDict(dict.type.project_type)}}
                </t-form-item>
                <t-form-item label="申报日期：" name="declareDate">
                  {{projectData.declareDate}}
                </t-form-item>
                <t-form-item label="编制日期：" >
                  {{data.compileDate}}
                </t-form-item>
                <t-form-item label="项目开始时间：" :style="{color:data.startDate!==projectData.startDate && reviewOpen && contrastOpen?'red':''}" name="startDate">
                  {{data.startDate?data.startDate:projectData.startDate}}
                </t-form-item>
                <t-form-item label="项目结束时间：" :style="{color:data.endDate!==projectData.endDate && reviewOpen && contrastOpen?'red':''}" name="endDate">
                  {{data.endDate?data.endDate:projectData.endDate}}
                </t-form-item>
                <t-form-item label="关键词：" name="keyWord">
                  {{projectData.keyWord}}
                </t-form-item>
                <t-form-item label="建议经费总概算：" :style="{color:data.adviceFunding!==projectData.adviceFunding && reviewOpen && contrastOpen?'red':''}" name="adviceFunding">
                  {{data.adviceFunding!== null?data.adviceFunding:projectData.adviceFunding}}万元
                </t-form-item>
                <t-form-item :label="site_tag==='jtt'?'申请厅补助经费：':'申请集团补助经费'" :style="{color:data.subsidyFunding!==projectData.subsidyFunding && reviewOpen && contrastOpen?'red':''}" name="subsidyFunding">
                  {{data.subsidyFunding!== null?data.subsidyFunding:projectData.subsidyFunding}}万元
                </t-form-item>
                <t-form-item :style="{color:(data.adviceFunding!==projectData.adviceFunding || data.subsidyFunding!==projectData.subsidyFunding) && reviewOpen && contrastOpen?'red':''}" label="自筹经费：" name="zcFunding">
                  <div v-if="data.adviceFunding!==null">
                    {{ (data.adviceFunding*100 - data.subsidyFunding*100)/100}}万元
                  </div>
                  <div v-else>
                    {{ (projectData.adviceFunding*100 - projectData.subsidyFunding*100)/100}}万元
                  </div>
                </t-form-item>
<!--                <t-form-item label="大纲编制日期：" >-->
<!--                  {{data.compileDate}}-->
<!--                </t-form-item>-->
<!--                <t-form-item label="项目概要：" >-->
<!--                  <div v-html="data.profile">-->
<!--                  </div>-->
<!--                </t-form-item>-->
              </t-card>
            </t-col>
            <t-col :span="6">
              <t-card class="step-card" size="small" title="项目组情况">
                <t-form-item label="总人数：" name="projectTeam.totalCount">
                  {{data.projectTeam.totalCount}}<div v-if="reviewOpen && contrastOpen && data.projectTeam?.totalCount && projectData.projectTeam?.totalCount!==data.projectTeam?.totalCount" class="exception-data" ><t-icon style="margin: 0px 5px" name="arrow-left"/>{{projectData.projectTeam.totalCount}}</div>
                </t-form-item>
                <t-form-item label="高级职称人数：" name="projectTeam.highCount">
                  {{data.projectTeam.highCount}} <div v-if="reviewOpen && contrastOpen && data.projectTeam?.highCount && projectData.projectTeam?.highCount!==data.projectTeam?.highCount" class="exception-data" ><t-icon style="margin: 0px 5px" name="arrow-left"/>{{projectData.projectTeam.highCount}}</div>
                </t-form-item>
                <t-form-item label="中级职称人数：" name="projectTeam.middleCount">
                  {{data.projectTeam.middleCount}}<div v-if="reviewOpen && contrastOpen && data.projectTeam?.middleCount && projectData.projectTeam?.middleCount!==data.projectTeam?.middleCount" class="exception-data" ><t-icon style="margin: 0px 5px" name="arrow-left"/>{{projectData.projectTeam.middleCount}}</div>
                </t-form-item>
                <t-form-item label="初级职称人数：" name="projectTeam.primaryCount">
                  {{data.projectTeam.primaryCount}}<div v-if="reviewOpen && contrastOpen && data.projectTeam?.primaryCount && projectData.projectTeam?.primaryCount!==data.projectTeam?.primaryCount" class="exception-data" ><t-icon style="margin: 0px 5px" name="arrow-left"/>{{projectData.projectTeam.primaryCount}}</div>
                </t-form-item>
                <t-form-item label="研究生人数：" name="projectTeam.postgraduate">
                  {{data.projectTeam.postgraduate}}<div v-if="reviewOpen && contrastOpen && data.projectTeam?.postgraduate && projectData.projectTeam?.postgraduate!==data.projectTeam?.postgraduate" class="exception-data" ><t-icon style="margin: 0px 5px" name="arrow-left"/>{{projectData.projectTeam.postgraduate}}</div>
                </t-form-item>
                <t-form-item label="辅助人员人数：" name="projectTeam.auxilian">
                  {{data.projectTeam.auxilian}}<div v-if="reviewOpen && contrastOpen && data.projectTeam?.auxilian && projectData.projectTeam?.auxilian!==data.projectTeam?.auxilian" class="exception-data" ><t-icon style="margin: 0px 5px" name="arrow-left"/>{{projectData.projectTeam.auxilian}}</div>
                </t-form-item>
<!--                <t-form-item label="项目概要：" >-->
<!--                  <div v-html="data.profile">-->
<!--                  </div>-->
<!--                </t-form-item>-->
              </t-card>
            </t-col>
          </t-row>
          <t-row style="align-items: stretch;row-gap: 12px" :gutter="14" v-if="!hideInfo">
            <t-col :span="6">
              <t-card class="step-card" size="small" title="项目负责人">
                <t-form-item label="姓名：" name="projectLeader.name">
                  {{projectData.projectLeader.name}}
                </t-form-item>
                <t-form-item label="性别：" name="projectLeader.sex">
                  {{projectData.projectLeader.sex  | filterByDict(dict.type.sys_user_sex)}}
                </t-form-item>
                <t-form-item label="出生年月：" name="projectLeader.birthDate">
                  {{projectData.projectLeader.birthDate}}
                </t-form-item>
                <t-form-item label="身份证号：" name="projectLeader.idCard">
                  {{projectData.projectLeader.idCard}}
                </t-form-item>
                <t-form-item label="工作单位：" name="projectLeader.companyId">
                  {{projectData.projectLeader.company}}
                </t-form-item>
<!--                <t-form-item label="归口单位：" name="projectLeader.companyId">-->
<!--                  {{projectData.attributeDeptName}}-->
<!--                </t-form-item>-->
                <t-form-item label="联系电话：" name="projectLeader.phone">
                  {{projectData.projectLeader.phone}}
                </t-form-item>
                <t-form-item label="通讯地址：" name="projectLeader.address">
                  {{projectData.projectLeader.address}}
                </t-form-item>
                <t-form-item label="电子信箱：" name="projectLeader.email">
                  {{projectData.projectLeader.email}}
                </t-form-item>
                <t-form-item label="邮编：" name="projectLeader.postCode">
                  {{projectData.projectLeader.postCode}}
                </t-form-item>
                <t-form-item label="毕业院校：" name="projectLeader.school">
                  {{projectData.projectLeader.school}}
                </t-form-item>
                <t-form-item label="学历：" name="projectLeader.education">
                  {{projectData.projectLeader.education | filterByDict(dict.type.education)}}
                </t-form-item>
                <t-form-item label="学位：" name="projectLeader.degree">
                  {{projectData.projectLeader.degree   | filterByDict(dict.type.degree)}}
                </t-form-item>
                <t-form-item label="所学专业：" name="projectLeader.majorName">
                  {{ projectData.projectLeader.majorName }}
                </t-form-item>
                <t-form-item label="现从事专业：" name="projectLeader.majorNowName">
                  {{ projectData.projectLeader.majorNowName }}
                </t-form-item>
                <t-form-item label="职务：" name="projectLeader.duty">
                  {{projectData.projectLeader.duty }}
                </t-form-item>
                <t-form-item label="技术职称：" name="projectLeader.profTitId">
                  {{ projectData.projectLeader.profTitId | filterByTree(profTitOptions) }}
                </t-form-item>
                <t-form-item label="职称：" name="projectLeader.profTit">
                  {{projectData.projectLeader.profTit    | filterByDict(dict.type.prof_tit) }}
                </t-form-item>
                <t-form-item label="在本项目中承担的任务：" name="projectLeader.task">
                  {{projectData.projectLeader.task}}
                </t-form-item>
              </t-card>
            </t-col>
            <t-col :span="6">
              <t-card class="step-card" size="small" title="项目联系人">
                <t-form-item label="姓名：" name="projectLinker.name">
                  {{projectData.projectLinker.name}}
                </t-form-item>
                <t-form-item label="联系电话：" name="projectLinker.phone">
                  {{projectData.projectLinker.phone}}
                </t-form-item>
                <t-form-item label="通信地址：" name="projectLinker.address">
                  {{projectData.projectLinker.address}}
                </t-form-item>
                <t-form-item label="电子信箱：" name="projectLinker.email">
                  {{projectData.projectLinker.email}}
                </t-form-item>
                <t-form-item label="邮编：" name="projectLinker.postCode">
                  {{projectData.projectLinker.postCode}}
                </t-form-item>
              </t-card>
            </t-col>
          </t-row>
        </t-form>
      </t-tab-panel>
      <t-tab-panel :class="[reviewOpen?'tab-full-panel':'tab-panel']" value="2" label="项目概要" :destroyOnHide="true">
        <t-card class="step-card" size="small" title="项目概要">
<!--                          <div v-html="data.profile">-->
<!--                          </div>-->
          <inner-html :content="data.profile"></inner-html>

        </t-card>
      </t-tab-panel>
      <t-tab-panel :class="[reviewOpen?'tab-full-panel':'tab-panel']" value="3" label="前期研究及工作基础" :destroyOnHide="true">
        <t-row style="align-items: stretch" :gutter="14">
          <t-col :span="12">
            <t-card class="step-card" size="small" title="项目前期研究及工作基础（包括国内外同类技术研究现状分析及评价，应附主要参考文献及出处）">
<!--              <div v-html="data.projectOutlinePreWork.preliminaryWork"></div>-->
              <inner-html :content="data.projectOutlinePreWork.preliminaryWork"></inner-html>

            </t-card>
          </t-col>
        </t-row>
        <t-row style="align-items: stretch" :gutter="14">
          <t-col :span="12">
            <t-card class="step-card" size="small" title="参考文献">
              <project-background-literature phaseType="2" ref="project-background-literature" :projectId="objId" v-model="data.projectOutlinePreWork.literatures" :editOpen="false"></project-background-literature>
            </t-card>
          </t-col>
        </t-row>
      </t-tab-panel>
      <t-tab-panel :class="[reviewOpen?'tab-full-panel':'tab-panel']" value="4" label="研究、开发的背景、必要性" :destroyOnHide="true">
        <t-row style="align-items: stretch" :gutter="14">
          <t-col :span="12">
            <t-card class="step-card" size="small" title="项目研究、开发的背景、必要性（包括项目研究目的，市场需求前景或推广应用领域，达到的技术水平及在国民经济发展中的作用等）">
<!--              <div v-html="data.projectOutlineNecessity.necessity"></div>-->
              <inner-html :content="data.projectOutlineNecessity.necessity"></inner-html>

            </t-card>
          </t-col>
        </t-row>
      </t-tab-panel>
      <t-tab-panel :class="[reviewOpen?'tab-full-panel':'tab-panel']" value="5" label="研究、开发实施方案" :destroyOnHide="true">
        <t-row style="align-items: stretch" :gutter="14">
          <t-col :span="12">
            <t-card class="step-card" size="small" title="项目研究、开发实施方案（包括拟解决的关键问题，实施的具体内容及实施方案，拟采取的技术路线等）：">
<!--              <div class="content_style" v-html="data.projectOutlineImplPlan.implementationPlan"></div>-->
              <inner-html :content="data.projectOutlineImplPlan.implementationPlan"></inner-html>

            </t-card>
          </t-col>
        </t-row>
        <t-row style="align-items: stretch" :gutter="14">
          <t-col :span="12">
            <t-card class="step-card" size="small" title="项目研究开发进度（包括年度工作计划安排，项目完成期限）:">
              <project-research-plan v-model="data.projectOutlineImplPlan.researchPlans" :disableDate="disableDate" :projectId="objId" :editOpen="false" phaseType="2"></project-research-plan>
            </t-card>
          </t-col>
        </t-row>
      </t-tab-panel>
      <t-tab-panel :class="[reviewOpen?'tab-full-panel':'tab-panel']" value="6" label="考核目标和技术经济指标" :destroyOnHide="true">
        <t-row style="align-items: stretch" :gutter="14">
          <t-col :span="12">
            <t-card class="step-card" size="small" title="考核目标">
              <project-approach-expect-results phaseType="2" :projectId="objId" ref="project-approach-expect-results"  v-model="data.projectOutlineGoal.projectExpectResults" :editOpen="false"></project-approach-expect-results>
            </t-card>
          </t-col>
        </t-row>
        <t-row style="align-items: stretch" :gutter="14">
          <t-col :span="12">
            <t-card class="step-card" size="small" title="技术经济指标">
<!--              <div v-html="data.projectOutlineGoal.goal"></div>-->
              <inner-html :content="data.projectOutlineGoal.goal"></inner-html>

            </t-card>
          </t-col>
        </t-row>
      </t-tab-panel>
      <t-tab-panel :class="[reviewOpen?'tab-full-panel':'tab-panel']" value="7" label="单位信息" :destroyOnHide="true">
        <t-row style="align-items: stretch" :gutter="14">
          <t-col :span="12">
            <project-unit v-model="data.projectCompanyList" :projectId="objId" :adviceFunding="data.adviceFunding" :editOpen="false" phaseType="2"></project-unit>
          </t-col>
        </t-row>
      </t-tab-panel>
      <t-tab-panel :class="[reviewOpen?'tab-full-panel':'tab-panel']" value="8" label="研究人员" v-if="!(hideByProjectType && projectData.projectType==='08')" :destroyOnHide="true">
        <t-row style="align-items: stretch" :gutter="14">
          <t-col :span="12">
            <project-member v-model="data.projectMembers" :projectId="objId" :editOpen="false" phaseType="2"></project-member>
          </t-col>
        </t-row>
      </t-tab-panel>
      <t-tab-panel :class="[reviewOpen?'tab-full-panel':'tab-panel']" value="9" label="经费预算" :destroyOnHide="true">
        <project-budget :contrastOpen="contrastOpen" v-model="data.projectBudget" :projectId="objId" :fundingObj="fundingObj" :editOpen="false" phaseType="2"></project-budget>
      </t-tab-panel>
      <t-tab-panel :class="[reviewOpen?'tab-full-panel':'tab-panel']" value="10" label="经济效益和社会效益评估" :destroyOnHide="true">
        <t-row style="align-items: stretch" :gutter="14">
          <t-col :span="12">
            <t-card class="step-card" size="small" title="经济效益和社会效益评估">
<!--              <div v-html="data.projectOutlineBenefits?.economicBenefits"></div>-->
              <inner-html :content="data.projectOutlineBenefits?.economicBenefits"></inner-html>

            </t-card>
          </t-col>
        </t-row>
      </t-tab-panel>
      <t-tab-panel :class="[reviewOpen?'tab-full-panel':'tab-panel']" value="11" label="其他问题" :destroyOnHide="true">
        <t-row style="align-items: stretch" :gutter="14">
          <t-col :span="12">
            <t-card class="step-card" size="small" title="其它需要说明的问题（软科学类研究项目要列明预期成果报告的章节）：">
<!--              <div class="content_style" v-html="data.projectOutlineOther?.otherProblems"></div>-->
              <inner-html :content="data.projectOutlineOther?.otherProblems"></inner-html>

            </t-card>
          </t-col>
        </t-row>
      </t-tab-panel>
      <t-tab-panel :class="[reviewOpen?'tab-full-panel':'tab-panel']" value="12" label="按立项专家评审意见修改说明" :destroyOnHide="true">
        <t-row v-if="projectData.isOldProject === '0'" style="align-items: stretch" :gutter="14">
          <t-col :span="12">
            <t-card class="step-card" size="small" title="专家评审意见">
              <approve-list-by-review-type review-type="1" :obj-id="objId"></approve-list-by-review-type>
            </t-card>
          </t-col>
        </t-row>
        <t-row style="align-items: stretch" :gutter="14">
          <t-col :span="12">
            <t-card class="step-card" size="small" title="按立项专家评审意见修改说明">
<!--              <div class="content_style" v-html="data.projectOutlineExplain?.content"></div>-->
              <inner-html :content="data.projectOutlineExplain?.content"></inner-html>

            </t-card>
          </t-col>
        </t-row>
      </t-tab-panel>
      <t-tab-panel :class="[reviewOpen?'tab-full-panel':'tab-panel']" value="13" label="附件信息" :destroyOnHide="true"  >
        <t-row style="align-items: stretch" :gutter="14">
          <t-col :span="12">
            <t-table v-if="isMyProject" row-key="id" :columns="fileColumns" :data="fileData">
              <template #op="{row}">
                <file-upload @success="uploadSuccess"  tips="限制pdf、图片" accept="application/pdf,image/*" v-model="row.fileIds" :moduleKey="row.moduleKey"
                             :fileList="row.fileLists"
                             :multiple="true">
                  <t-button variant="outline">
                    <t-icon name="cloud-upload" slot="icon"/>
                    点击上传
                  </t-button>
                </file-upload>
              </template>
              <template #c1="{row}">
                <a v-if="row.c3" class="t-button-link" :href="`${file_domain}/${row.c3}`" target="_blank">{{ row.c1 }}</a>
                <div v-else>{{ row.c1 }}</div>
              </template>
            </t-table>
            <t-table v-else row-key="id" :columns="fileColumns" :data="fileData">
              <template #c1="{row}">
                <a v-if="row.c3" class="t-button-link" :href="`${file_domain}/${row.c3}`" target="_blank">{{ row.c1 }}</a>
                <div v-else>{{ row.c1 }}</div>
              </template>
              <template  #op="{row}">
                <div v-for="(item,index) in row.fileLists" :key="index">
                  <a class="t-button-link" target="_blank" :href="item.url" >
                    {{item.name}}
                  </a>
                </div>
              </template>
            </t-table>
          </t-col>
        </t-row>
      </t-tab-panel>
    </t-tabs>

  </div>
</template>

<script>
import { VITE_FILE_DOMAIN } from '@/api/upload'
import ProjectResearchPlan from '../../pm/components/project-research-plan.vue'
import ProjectMember from '../../pm/components/project-member.vue'
import ProjectUnit from '../../pm/components/project-unit.vue'
import {getFiles} from "@/api/common";
import ProjectBudget from '../../pm/components/project-budget.vue'
import ProjectApproachExpectResults from "../../pm/components/project-approach-expectResults.vue";
import ProjectBackgroundLiterature from "../../pm/components/project-background-literature.vue";
import dayjs from "dayjs";
import FileUpload from "@/components/FileUpload/index.vue"
import approveListByReviewType from "../../approve/components/approve-list-by-review-type.vue";
import InnerHtml from "@/components/InnerHtml/index.vue";


export default {
  name: "outline-detail-dialog",
  dicts:["project_type", "subject_classification", "sys_user_sex", "prof_tit", "degree", "duty", "platform_type", "member_type","education", "recommend_type"],
  components:{
    ProjectResearchPlan,
    ProjectMember,
    ProjectBudget,
    ProjectApproachExpectResults,
    ProjectUnit,
    FileUpload,
    ProjectBackgroundLiterature,
    approveListByReviewType,
    InnerHtml
  },
  props:{
    objId: [String,Number],
    outlineId: [String,Number],
    // header: String,
    isDialog:{
      type: Boolean,
      default: true
    },
    hideInfo: {
      type: Boolean,
      default: false
    },
    hideByProjectType:{
      type: Boolean,
      default: false
    },
    size:{
      type: String,
      default: 'large'
    },
    reviewOpen: {
      type: Boolean,
      default: false
    },
    contrastOpen: {
      type: Boolean,
      default: false
    }
  },
  data(){
    return {
      header: '',
      site_tag: import.meta.env.VITE_SITE_TAG,
      file_domain: VITE_FILE_DOMAIN,
      isMyProject: false,
      fileColumns: [
        {
          colKey: "id",
          title: "序号",
          align: "center",
          width: 64
        },
        {
          colKey: "c1",
          title: "附件名称",
          align: "center",
        },

        {
          colKey: "c2",
          title: "是否必需",
          align: "center",
        },
        {
          colKey: "op",
          title: "附件列表",
          align: "left",
        },
      ],
      fileData: [
        {
          id: 1,
          c1: "已盖章大纲",
          c2: "审批通过之后，走完盖章流程后上传。",
          fileIds: [],
          fileLists: [],
          moduleKey: "projectDG"
        },
        // {
        //   id: 2,
        //   c1: "大纲评审专家转账凭证",
        //   c2: "大纲评审会议后上传",
        //   fileIds: [],
        //   fileLists: [],
        //   moduleKey: "projectDGPSZJF"
        // }
      ],
      fundingObj: {subsidyFunding: 0, adviceFunding: 0},
      disableDate: {},
      profTitOptions: [],
      projectData: {
        projectCategory:'',
        projectTeam:{},
        projectLeader:{},
        projectLinker:{},
        projectBackground:{
          background:''
        },
        projectApproach:{
          projectExpectResults: []
        },
        projectBasicstudy:{},
        projectCompanyList:[],
        projectMembers:[],
        projectBudget:{}
      },
      projectCategoryOptions:[],
      visible:true,
      tabValue:"1",
      data:{
        project:{},
        projectResearchPlans:[],
        projectTeam: {},
        projectOutlinePreWork:{},
        projectOutlineNecessity:{},
        projectOutlineImplPlan:{},
        projectCompanyList:[],
        projectBudget:{},
        projectOutlineOther:{},
        projectMemberList:[],
        projectOutlineExplain: {},
        projectOutlineGoal: {},
      },
    }
  },
  watch: {
    objId: {
      immediate: true,
      handler(val) {
        if (val) {
          this.getObj(val);
        }
      }
    },
  },
  methods:{
    createPDF(){
      const instance = this.$loading({
        fullscreen: true,
        attach: 'body',
        preventScrollThrough: false,
      });
      this.$api.kjxm.outline.createPDF(this.objId,1).then(response => {
        window.open(response.data.fullFilePath, '_blank')
        instance.hide();
      }).catch((e) => {
        instance.hide();
        this.$message.error(e.toString());
      });
    },
    uploadSuccess(ids){
      this.$api.kjxm.project.edit({
        id: this.objId,
        sysAttMainVo: {
          sysAttMainIds: ids,
        }
      }).then(val => {
        this.$message.success("上传成功");
      }).catch((e) => {
        this.$message.error(e.toString());
      });
    },
    getDeclareTree() {
      return this.$api.kjxm.project.planCategoryTree().then(response => {
        this.projectCategoryOptions = response.data;
      }).catch((e) => {
        this.$message.error(e.toString());
      });
    },
    async getObj(){
      await Promise.all([this.getDeclareTree(), this.getprofTitTreeSelect()]);
      // 获取项目附件
      getFiles(this.objId).then((res) => {
        const files = {}
        res.data.forEach((item) => {
          if (!files[item.moduleKey]) {
            files[item.moduleKey] = []
          }
          files[item.moduleKey].push({
            name: item.fileName,
            url: item.fullFilePath,
            id: item.id,
            filePath: item.filePath
          })
        })
        this.fileData.forEach((val, index) => {
          this.fileData[index].fileLists = files[val.moduleKey] || [];
          this.fileData[index].fileIds = files[val.moduleKey]?.map(val => val.id) || [];
        })

      }).catch((e) => {
        this.$message.error(e.toString());
      });
      this.$api.kjxm.project.get(this.objId).then(pro => {
        if(pro.data.createUserId===Number(this.$store.state.user.userId)){
          this.isMyProject = true;
        }
        this.projectData = pro.data;
        // 根据当前项目限定时间
        this.disableDate = {
          before:dayjs(pro.data.startDate,"YYYY-MM-DD").endOf('month').subtract(1, 'month').format(),
          after:dayjs(pro.data.endDate,"YYYY-MM-DD").endOf('month').subtract(0, 'month').format(),
        }

        this.$api.kjxm.outline.getAll(this.objId).then(response => {
          this.header = response.data.projectName || pro.data.projectName;
          this.data = response.data;
          this.fundingObj = {
            adviceFunding: response.data.adviceFunding,
            subsidyFunding: response.data.subsidyFunding
          }
          this.adviceFunding = response.data.adviceFunding;
          this.subsidyFunding = response.data.subsidyFunding;
        }).catch((e) => {
          this.$message.error(e.toString());
        });

      }).catch((e) => {
        this.$message.error(e.toString());
      });

    },
    getprofTitTreeSelect() {
      return this.$api.system.profTit.treeselect().then(response => {
        this.profTitOptions = response.data;
        // this.profTitOptions = this.handleTree(response.data, "id");
      }).catch((e) => {
        this.$message.error(e.toString());
      });
    },
    closeDialog() {
      this.$emit("update:visible", false);
    },
  }
}
</script>

<style lang="less" scoped>
.tab-panel{
  padding: 10px;
  height: calc(65vh - 64px);
  overflow: scroll;
}
.tab-full-panel{
  padding: 10px;
  height: calc(80vh - 64px);
  overflow: scroll;
}
.t-form__item{
  margin-bottom:6px
}

.t-row {
  margin-bottom: 14px;
}
.exception-data{
  color: red;
  height: 100%;
  display: flex;
  align-items: center
}

.step-card {
  height: 100%;
  margin-bottom: 14px;
}
</style>
